/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.liquidByte.trafficMustang.server.dataModel;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;

/**
 *
 * @author Alexandre
 */
@Entity
@Table(name = "conta")
public class Conta implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "USR_ID")
    private Integer usrId;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @NotNull
    @Column(name = "CONTA_SALD")
    private BigDecimal contaSald;
    @Basic(optional = false)
    @NotNull
    @Column(name = "CONTA_DT_APUR")
    @Temporal(TemporalType.TIMESTAMP)
    private Date contaDtApur;
    @JoinColumn(name = "USR_ID", referencedColumnName = "USR_ID", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Usuario usuario;
    @OneToMany(mappedBy = "contaId")
    private List<Transacao> transacaoList;

    public Conta() {
    }

    public Conta(Integer usrId) {
        this.usrId = usrId;
    }

    public Conta(Integer usrId, BigDecimal contaSald, Date contaDtApur) {
        this.usrId = usrId;
        this.contaSald = contaSald;
        this.contaDtApur = contaDtApur;
    }

    public Integer getUsrId() {
        return usrId;
    }

    public void setUsrId(Integer usrId) {
        this.usrId = usrId;
    }

    public BigDecimal getContaSald() {
        return contaSald;
    }

    public void setContaSald(BigDecimal contaSald) {
        this.contaSald = contaSald;
    }

    public Date getContaDtApur() {
        return contaDtApur;
    }

    public void setContaDtApur(Date contaDtApur) {
        this.contaDtApur = contaDtApur;
    }

    public Usuario getUsuario() {
        return usuario;
    }

    public void setUsuario(Usuario usuario) {
        this.usuario = usuario;
    }

    public List<Transacao> getTransacaoList() {
        return transacaoList;
    }

    public void setTransacaoList(List<Transacao> transacaoList) {
        this.transacaoList = transacaoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (usrId != null ? usrId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Conta)) {
            return false;
        }
        Conta other = (Conta) object;
        if ((this.usrId == null && other.usrId != null) || (this.usrId != null && !this.usrId.equals(other.usrId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.liquidByte.trafficMustang.server.dataModel.Conta[ usrId=" + usrId + " ]";
    }
    
}
